import { JSEncrypt } from "jsencrypt";

export function encryptedData(data: string) {
  const encryptor = new JSEncrypt();
  const PUBLIC_KEY =
  "-----BEGIN PUBLIC KEY-----MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqUqlZlrn+rDKnY6A1iwwAR8DwNQIOfaNeya8qrdoQ42TI7/sX5cO7JPAAs0e5Di16I9DKlZcf1oW827L4jMibpznpurQbo+yku98f5PVAf4nZkQvaGt15kwgBIDOlKFAdfftplWsCd+qsAABIgfyJAeBiYKJcXmCOEsd5fFB3/hLPOEWBwrM0tQBsDJ8g5nxxOAbtnY/FDtpTL4YUOeujUbAWpzAeEgRhYMfSe4rRk6MnCBnmO/rkVQWA5xUC1aSYRaYeuclJY3PDut4nRiZcDkaiZqcynXslA/Og7yMkjZRo3gkNwIiyUq2nByQNdqn4l166v9prhBn2rdMsLJxewIDAQAB-----END PUBLIC KEY-----";

  encryptor.setPublicKey(PUBLIC_KEY);
  return encryptor.encrypt(data);
}